package com.dp.springsourcecodeanalysis.exceptions;

import com.dp.springsourcecodeanalysis.enums.HttpEnum;

/**
 *
 * @author shala/沙拉
 * @date 2021/12/31 16:55
 */
public class AppException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private Integer code;

    public AppException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public Integer getCode() {
        return this.code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public static AppException create(String message) {
        return create(message, HttpEnum.ERR.getCode());
    }

    public static AppException create(String message, Integer code) {
        return new AppException(message, code);
    }

}
